package com.wootide.cms.sys.menu.dao.imp;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.wootide.cms.log.syslog.RunLog;
import com.wootide.cms.sys.menu.dao.MenuInfoDao;
import com.wootide.cms.sys.menu.pojo.MenuInfo;

/**
 * 菜单管理数据访问接口实现层
 * 〈功能详细描述〉
 * @author develop
 * @version 2013-5-28
 * @see MenuInfoDaoImp
 * @since
 */
public class MenuInfoDaoImp extends HibernateDaoSupport implements MenuInfoDao
{

    /**
     * 日志记录
     */
    private RunLog runLog;
    
    @SuppressWarnings("rawtypes")
    public MenuInfo findOneByMenuName(String menuName)
    {
        runLog.debug("menuName" +menuName);
        List list = getHibernateTemplate().findByNamedQuery("findOneByMenuName",menuName);
        
        return list.isEmpty() ? null : (MenuInfo)list.get(0);
    }

    public int findNumByMenuName(String menuName)
    {
        runLog.debug("menuName=" +menuName);
        return ((Number)getHibernateTemplate().findByNamedQuery("findNumByMenuName",
                menuName).get(0)).intValue();
    }

    public MenuInfo findOneByMenuId(String menuId)
    {
        runLog.debug("menuId=" +menuId);
        return null;
    }

    public RunLog getRunLog()
    {
        return runLog;
    }

    public void setRunLog(RunLog runLog)
    {
        this.runLog = runLog;
    }
}
